<!DOCTYPE html>
<html lang=zh>
<head>
    <meta charset="utf-8">
    
    <title>Spring Boot 集成Shiro和CAS | LErry</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="请大家在看本文之前，先了解如下知识点：1、Shiro 是什么？怎么用？2、Cas 是什么？怎么用？3、最好有Spring基础 可以先看看这两篇文章，按照这2篇文章的内容做一遍： Spring Boot Shiro 权限管理  CAS单点登录  首先看一下下面这张图：第一个流程是单纯使用Shiro的流程。第二个流程是单纯使用Cas的流程。第三个图是Shiro集成Cas后的流程。 【流程图高清图连接：">
<meta name="keywords" content="spring,shiro,cas">
<meta property="og:type" content="article">
<meta property="og:title" content="Spring Boot 集成Shiro和CAS">
<meta property="og:url" content="https://www.itchina.top/2018/04/20/Spring Boot 集成Shiro和CAS/index.html">
<meta property="og:site_name" content="LErry">
<meta property="og:description" content="请大家在看本文之前，先了解如下知识点：1、Shiro 是什么？怎么用？2、Cas 是什么？怎么用？3、最好有Spring基础 可以先看看这两篇文章，按照这2篇文章的内容做一遍： Spring Boot Shiro 权限管理  CAS单点登录  首先看一下下面这张图：第一个流程是单纯使用Shiro的流程。第二个流程是单纯使用Cas的流程。第三个图是Shiro集成Cas后的流程。 【流程图高清图连接：">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://img-blog.csdn.net/20160117224937078">
<meta property="og:image" content="http://static.blog.csdn.net/images/save_snippets.png">
<meta property="og:image" content="http://static.blog.csdn.net/images/save_snippets.png">
<meta property="og:image" content="http://static.blog.csdn.net/images/save_snippets.png">
<meta property="og:image" content="http://static.blog.csdn.net/images/save_snippets.png">
<meta property="og:updated_time" content="2018-04-25T12:25:55.630Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Spring Boot 集成Shiro和CAS">
<meta name="twitter:description" content="请大家在看本文之前，先了解如下知识点：1、Shiro 是什么？怎么用？2、Cas 是什么？怎么用？3、最好有Spring基础 可以先看看这两篇文章，按照这2篇文章的内容做一遍： Spring Boot Shiro 权限管理  CAS单点登录  首先看一下下面这张图：第一个流程是单纯使用Shiro的流程。第二个流程是单纯使用Cas的流程。第三个图是Shiro集成Cas后的流程。 【流程图高清图连接：">
<meta name="twitter:image" content="https://img-blog.csdn.net/20160117224937078">
    

    
        <link rel="alternate" href="/atom.xml" title="LErry" type="application/atom+xml" />
    

    
        <link rel="icon" href="/css/images/shortcut_icon.png" />
    

    <link rel="stylesheet" href="/libs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/libs/open-sans/styles.css">
    <link rel="stylesheet" href="/libs/source-code-pro/styles.css">

    <link rel="stylesheet" href="/css/style.css">

    <script src="/libs/jquery/2.1.3/jquery.min.js"></script>
    
    
        <link rel="stylesheet" href="/libs/lightgallery/css/lightgallery.min.css">
    
    
        <link rel="stylesheet" href="/libs/justified-gallery/justifiedGallery.min.css">
    
    
    
    


</head>

<body>
    <div id="container">
        <header id="header">
    <div id="header-main" class="header-inner">
        <div class="outer">
            <a href="/" id="logo">
                <i class="logo"></i>
                <span class="site-title">LErry</span>
            </a>
            <nav id="main-nav">
                
                    <a class="main-nav-link" href="/.">主页</a>
                
                    <a class="main-nav-link" href="/freebooks">书籍</a>
                
                    <a class="main-nav-link" href="/tags">标签</a>
                
                    <a class="main-nav-link" href="/archives">归档</a>
                
                    <a class="main-nav-link" href="/aboutme">关于</a>
                
            </nav>
            
                
                <nav id="sub-nav">
                    <div class="profile" id="profile-nav">
                        <a id="profile-anchor" href="javascript:;">
                            <img class="avatar" src="/css/images/avatar.png" />
                            <i class="fa fa-caret-down"></i>
                        </a>
                    </div>
                </nav>
            
            <div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="想要查找什么..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>

</div>
        </div>
    </div>
    <div id="main-nav-mobile" class="header-sub header-inner">
        <table class="menu outer">
            <tr>
                
                    <td><a class="main-nav-link" href="/.">主页</a></td>
                
                    <td><a class="main-nav-link" href="/freebooks">书籍</a></td>
                
                    <td><a class="main-nav-link" href="/tags">标签</a></td>
                
                    <td><a class="main-nav-link" href="/archives">归档</a></td>
                
                    <td><a class="main-nav-link" href="/aboutme">关于</a></td>
                
                <td>
                    
    <div class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
    </div>

                </td>
            </tr>
        </table>
    </div>
</header>

        <div class="outer">
            
                

<aside id="profile">
    <div class="inner profile-inner">
        <div class="base-info profile-block">
            <img id="avatar" src="/css/images/avatar.png" />
            <h2 id="name">LErry Li</h2>
            <h3 id="title">知我者谓我心忧，不知我者谓我何求</h3>
            <span id="location"><i class="fa fa-map-marker"></i>Shanghai, China</span>
            <a id="follow" target="_blank" href="https://github.com/lerry903">关注我</a>
        </div>
        <div class="article-info profile-block">
            <div class="article-info-block">
                65
                <span>文章</span>
            </div>
            <div class="article-info-block">
                54
                <span>标签</span>
            </div>
        </div>
        
        <div class="profile-block social-links">
            <table>
                <tr>
                    
                    
                    <td>
                        <a href="https://github.com/lerry903" target="_blank" title="github" class=tooltip>
                            <i class="fa fa-github"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="mailto:lerryli@foxmail.com" target="_blank" title="envelope" class=tooltip>
                            <i class="fa fa-envelope"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="http://wpa.qq.com/msgrd?v=3&uin=824444270&site=qq&menu=yes" target="_blank" title="qq" class=tooltip>
                            <i class="fa fa-qq"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="https://weibo.com/5941010376" target="_blank" title="weibo" class=tooltip>
                            <i class="fa fa-weibo"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/atom.xml" target="_blank" title="rss" class=tooltip>
                            <i class="fa fa-rss"></i>
                        </a>
                    </td>
                    
                </tr>
            </table>
        </div>
        
    </div>
</aside>

            
            <section id="main"><article id="post-Spring Boot 集成Shiro和CAS" class="article article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
        
        
            <header class="article-header">
                
    
        <h1 class="article-title" itemprop="name">
            Spring Boot 集成Shiro和CAS
        </h1>
    

                
                    <div class="article-meta">
                        
    <div class="article-date">
        <i class="fa fa-calendar"></i>
        <a href="/2018/04/20/Spring Boot 集成Shiro和CAS/">
            <time datetime="2018-04-19T16:34:21.437Z" itemprop="datePublished">2018-04-20</time>
        </a>
    </div>


                        
    <div class="article-category">
    	<i class="fa fa-folder"></i>
        <a class="article-category-link" href="/categories/Spring/">Spring</a>
    </div>

                        
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/tags/cas/">cas</a>, <a class="tag-link" href="/tags/shiro/">shiro</a>, <a class="tag-link" href="/tags/spring/">spring</a>
    </div>

                    </div>
                
            </header>
        
        
        <div class="article-entry" itemprop="articleBody">
        
            
            <p>请大家在看本文之前，先了解如下知识点：<br>1、Shiro 是什么？怎么用？<br>2、Cas 是什么？怎么用？<br>3、最好有Spring基础</p>
<p>可以先看看这两篇文章，按照这2篇文章的内容做一遍：<br><a href="http://blog.csdn.net/catoop/article/details/50520958" target="_blank" rel="noopener"> Spring Boot Shiro 权限管理
</a><br><a href="http://blog.csdn.net/catoop/article/details/50530364" target="_blank" rel="noopener"> CAS单点登录 </a></p>
<p>首先看一下下面这张图：<br>第一个流程是单纯使用Shiro的流程。<br>第二个流程是单纯使用Cas的流程。<br>第三个图是Shiro集成Cas后的流程。</p>
<p>【流程图高清图连接： <a href="https://img-
blog.csdn.net/20160117224937078" target="_blank" rel="noopener"> https://img-blog.csdn.net/20160117224937078 </a> 】</p>
<p><img src="https://img-blog.csdn.net/20160117224937078" alt="流程图"></p>
<p>PS：流程图急急忙忙画的，整体上应该没有什么问题，具体细节问题还请大家留言指正。</p>
<p>如果你只是打算用到你的Spring Boot项目中，那么看着如下配置完成便可。<br>如果你想进一步了解其中的细节，还是建议大家单独配置Shiro、单独配置Cas，看看官方相关文档。<br>Shiro在1.2版本开始提供了对cas的集成，按下面添加依赖到pom.xml中：</p>
<pre><code>&lt;!--Apache Shiro所需的jar包 --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
    &lt;artifactId&gt;shiro-spring&lt;/artifactId&gt;
    &lt;version&gt;1.2.4&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;  
    &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;  
    &lt;artifactId&gt;shiro-ehcache&lt;/artifactId&gt;  
    &lt;version&gt;1.2.4&lt;/version&gt;  
&lt;/dependency&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
    &lt;artifactId&gt;shiro-cas&lt;/artifactId&gt;
    &lt;version&gt;1.2.4&lt;/version&gt;
&lt;/dependency&gt;
</code></pre><ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
<li>9 </li>
<li>10 </li>
<li>11 </li>
<li>12 </li>
<li>13 </li>
<li>14 </li>
<li>15 </li>
<li>16 </li>
</ul>
<p><img src="http://static.blog.csdn.net/images/save_snippets.png" alt=""></p>
<ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
<li>9 </li>
<li>10 </li>
<li>11 </li>
<li>12 </li>
<li>13 </li>
<li>14 </li>
<li>15 </li>
<li>16 </li>
</ul>
<p>shiro-cas 依赖 shiro-web，shiro-web 依赖 shiro-core，所以添加shiro-cas后shiro-web<br>.jar和shiro-core.jar会自动被引用。<br>cas被shiro集成后，其原理就是shiro将casFilter加入到shiroFilter的filterChain中。</p>
<p>在SpringBoot工程中创建ShiroCasConfiguration. <a href="http://lib.csdn.net/base/17" target="_blank" rel="noopener"> Java </a></p>
<pre><code>package org.springboot.sample.config;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import javax.servlet.Filter;

import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.apache.shiro.cas.CasFilter;
import org.apache.shiro.cas.CasSubjectFactory;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springboot.sample.dao.IScoreDao;
import org.springboot.sample.security.MyShiroCasRealm;
import org.springboot.sample.service.StudentService;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.DelegatingFilterProxy;

/**
 * Shiro集成Cas配置
 *
 * @author   单红宇(365384722)
 * @myblog  http://blog.csdn.net/catoop/
 * @create    2016年1月17日
 */
@Configuration
public class ShiroCasConfiguration {

    private static final Logger logger = LoggerFactory.getLogger(ShiroCasConfiguration.class);

    // CasServerUrlPrefix
    public static final String casServerUrlPrefix = &quot;https://localhost:8443/cas&quot;;
    // Cas登录页面地址
    public static final String casLoginUrl = casServerUrlPrefix + &quot;/login&quot;;
    // Cas登出页面地址
    public static final String casLogoutUrl = casServerUrlPrefix + &quot;/logout&quot;;
    // 当前工程对外提供的服务地址
    public static final String shiroServerUrlPrefix = &quot;http://localhost:9090/myspringboot&quot;;
    // casFilter UrlPattern
    public static final String casFilterUrlPattern = &quot;/shiro-cas&quot;;
    // 登录地址
    public static final String loginUrl = casLoginUrl + &quot;?service=&quot; + shiroServerUrlPrefix + casFilterUrlPattern;

    @Bean
    public EhCacheManager getEhCacheManager() {  
        EhCacheManager em = new EhCacheManager();  
        em.setCacheManagerConfigFile(&quot;classpath:ehcache-shiro.xml&quot;);  
        return em;  
    }  

    @Bean(name = &quot;myShiroCasRealm&quot;)
    public MyShiroCasRealm myShiroCasRealm(EhCacheManager cacheManager) {  
        MyShiroCasRealm realm = new MyShiroCasRealm(); 
        realm.setCacheManager(cacheManager);
        return realm;
    } 

    /**
     * 注册DelegatingFilterProxy（Shiro）
     *
     * @param dispatcherServlet
     * @return
     * @author SHANHY
     * @create  2016年1月13日
     */
    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
        filterRegistration.setFilter(new DelegatingFilterProxy(&quot;shiroFilter&quot;));
        //  该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理  
        filterRegistration.addInitParameter(&quot;targetFilterLifecycle&quot;, &quot;true&quot;);
        filterRegistration.setEnabled(true);
        filterRegistration.addUrlPatterns(&quot;/*&quot;);
        return filterRegistration;
    }

    @Bean(name = &quot;lifecycleBeanPostProcessor&quot;)
    public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
        return new LifecycleBeanPostProcessor();
    }

    @Bean
    public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
        DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator();
        daap.setProxyTargetClass(true);
        return daap;
    }

    @Bean(name = &quot;securityManager&quot;)
    public DefaultWebSecurityManager getDefaultWebSecurityManager(MyShiroCasRealm myShiroCasRealm) {
        DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
        dwsm.setRealm(myShiroCasRealm);
//      &lt;!-- 用户授权/认证信息Cache, 采用EhCache 缓存 --&gt; 
        dwsm.setCacheManager(getEhCacheManager());
        // 指定 SubjectFactory
        dwsm.setSubjectFactory(new CasSubjectFactory());
        return dwsm;
    }

    @Bean
    public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
        AuthorizationAttributeSourceAdvisor aasa = new AuthorizationAttributeSourceAdvisor();
        aasa.setSecurityManager(securityManager);
        return aasa;
    }

    /**
     * 加载shiroFilter权限控制规则（从数据库读取然后配置）
     *
     * @author SHANHY
     * @create  2016年1月14日
     */
    private void loadShiroFilterChain(ShiroFilterFactoryBean shiroFilterFactoryBean, StudentService stuService, IScoreDao scoreDao){
        /////////////////////// 下面这些规则配置最好配置到配置文件中 ///////////////////////
        Map&lt;String, String&gt; filterChainDefinitionMap = new LinkedHashMap&lt;String, String&gt;();

        filterChainDefinitionMap.put(casFilterUrlPattern, &quot;casFilter&quot;);// shiro集成cas后，首先添加该规则

        // authc：该过滤器下的页面必须验证后才能访问，它是Shiro内置的一个拦截器org.apache.shiro.web.filter.authc.FormAuthenticationFilter
        filterChainDefinitionMap.put(&quot;/user&quot;, &quot;authc&quot;);// 这里为了测试，只限制/user，实际开发中请修改为具体拦截的请求规则
        // anon：它对应的过滤器里面是空的,什么都没做
        logger.info(&quot;##################从数据库读取权限规则，加载到shiroFilter中##################&quot;);
        filterChainDefinitionMap.put(&quot;/user/edit/**&quot;, &quot;authc,perms[user:edit]&quot;);// 这里为了测试，固定写死的值，也可以从数据库或其他配置中读取

        filterChainDefinitionMap.put(&quot;/login&quot;, &quot;anon&quot;);
        filterChainDefinitionMap.put(&quot;/**&quot;, &quot;anon&quot;);//anon 可以理解为不拦截

        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
    }

    /**
     * CAS过滤器
     *
     * @return
     * @author SHANHY
     * @create  2016年1月17日
     */
    @Bean(name = &quot;casFilter&quot;)
    public CasFilter getCasFilter() {
        CasFilter casFilter = new CasFilter();
        casFilter.setName(&quot;casFilter&quot;);
        casFilter.setEnabled(true);
        // 登录失败后跳转的URL，也就是 Shiro 执行 CasRealm 的 doGetAuthenticationInfo 方法向CasServer验证tiket
        casFilter.setFailureUrl(loginUrl);// 我们选择认证失败后再打开登录页面
        return casFilter;
    }

    /**
     * ShiroFilter&lt;br/&gt;
     * 注意这里参数中的 StudentService 和 IScoreDao 只是一个例子，因为我们在这里可以用这样的方式获取到相关访问数据库的对象，
     * 然后读取数据库相关配置，配置到 shiroFilterFactoryBean 的访问规则中。实际项目中，请使用自己的Service来处理业务逻辑。
     *
     * @param myShiroCasRealm
     * @param stuService
     * @param scoreDao
     * @return
     * @author SHANHY
     * @create  2016年1月14日
     */
    @Bean(name = &quot;shiroFilter&quot;)
    public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager securityManager, CasFilter casFilter, StudentService stuService, IScoreDao scoreDao) {
        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
        // 必须设置 SecurityManager  
        shiroFilterFactoryBean.setSecurityManager(securityManager);
        // 如果不设置默认会自动寻找Web工程根目录下的&quot;/login.jsp&quot;页面
        shiroFilterFactoryBean.setLoginUrl(loginUrl);
        // 登录成功后要跳转的连接
        shiroFilterFactoryBean.setSuccessUrl(&quot;/user&quot;);
        shiroFilterFactoryBean.setUnauthorizedUrl(&quot;/403&quot;);
        // 添加casFilter到shiroFilter中
        Map&lt;String, Filter&gt; filters = new HashMap&lt;&gt;();
        filters.put(&quot;casFilter&quot;, casFilter);
        shiroFilterFactoryBean.setFilters(filters);

        loadShiroFilterChain(shiroFilterFactoryBean, stuService, scoreDao);
        return shiroFilterFactoryBean;
    }

}
</code></pre><ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
<li>9 </li>
<li>10 </li>
<li>11 </li>
<li>12 </li>
<li>13 </li>
<li>14 </li>
<li>15 </li>
<li>16 </li>
<li>17 </li>
<li>18 </li>
<li>19 </li>
<li>20 </li>
<li>21 </li>
<li>22 </li>
<li>23 </li>
<li>24 </li>
<li>25 </li>
<li>26 </li>
<li>27 </li>
<li>28 </li>
<li>29 </li>
<li>30 </li>
<li>31 </li>
<li>32 </li>
<li>33 </li>
<li>34 </li>
<li>35 </li>
<li>36 </li>
<li>37 </li>
<li>38 </li>
<li>39 </li>
<li>40 </li>
<li>41 </li>
<li>42 </li>
<li>43 </li>
<li>44 </li>
<li>45 </li>
<li>46 </li>
<li>47 </li>
<li>48 </li>
<li>49 </li>
<li>50 </li>
<li>51 </li>
<li>52 </li>
<li>53 </li>
<li>54 </li>
<li>55 </li>
<li>56 </li>
<li>57 </li>
<li>58 </li>
<li>59 </li>
<li>60 </li>
<li>61 </li>
<li>62 </li>
<li>63 </li>
<li>64 </li>
<li>65 </li>
<li>66 </li>
<li>67 </li>
<li>68 </li>
<li>69 </li>
<li>70 </li>
<li>71 </li>
<li>72 </li>
<li>73 </li>
<li>74 </li>
<li>75 </li>
<li>76 </li>
<li>77 </li>
<li>78 </li>
<li>79 </li>
<li>80 </li>
<li>81 </li>
<li>82 </li>
<li>83 </li>
<li>84 </li>
<li>85 </li>
<li>86 </li>
<li>87 </li>
<li>88 </li>
<li>89 </li>
<li>90 </li>
<li>91 </li>
<li>92 </li>
<li>93 </li>
<li>94 </li>
<li>95 </li>
<li>96 </li>
<li>97 </li>
<li>98 </li>
<li>99 </li>
<li>100 </li>
<li>101 </li>
<li>102 </li>
<li>103 </li>
<li>104 </li>
<li>105 </li>
<li>106 </li>
<li>107 </li>
<li>108 </li>
<li>109 </li>
<li>110 </li>
<li>111 </li>
<li>112 </li>
<li>113 </li>
<li>114 </li>
<li>115 </li>
<li>116 </li>
<li>117 </li>
<li>118 </li>
<li>119 </li>
<li>120 </li>
<li>121 </li>
<li>122 </li>
<li>123 </li>
<li>124 </li>
<li>125 </li>
<li>126 </li>
<li>127 </li>
<li>128 </li>
<li>129 </li>
<li>130 </li>
<li>131 </li>
<li>132 </li>
<li>133 </li>
<li>134 </li>
<li>135 </li>
<li>136 </li>
<li>137 </li>
<li>138 </li>
<li>139 </li>
<li>140 </li>
<li>141 </li>
<li>142 </li>
<li>143 </li>
<li>144 </li>
<li>145 </li>
<li>146 </li>
<li>147 </li>
<li>148 </li>
<li>149 </li>
<li>150 </li>
<li>151 </li>
<li>152 </li>
<li>153 </li>
<li>154 </li>
<li>155 </li>
<li>156 </li>
<li>157 </li>
<li>158 </li>
<li>159 </li>
<li>160 </li>
<li>161 </li>
<li>162 </li>
<li>163 </li>
<li>164 </li>
<li>165 </li>
<li>166 </li>
<li>167 </li>
<li>168 </li>
<li>169 </li>
<li>170 </li>
<li>171 </li>
<li>172 </li>
<li>173 </li>
<li>174 </li>
<li>175 </li>
<li>176 </li>
<li>177 </li>
<li>178 </li>
<li>179 </li>
<li>180 </li>
<li>181 </li>
<li>182 </li>
<li>183 </li>
<li>184 </li>
<li>185 </li>
<li>186 </li>
<li>187 </li>
<li>188 </li>
</ul>
<p><img src="http://static.blog.csdn.net/images/save_snippets.png" alt=""></p>
<ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
<li>9 </li>
<li>10 </li>
<li>11 </li>
<li>12 </li>
<li>13 </li>
<li>14 </li>
<li>15 </li>
<li>16 </li>
<li>17 </li>
<li>18 </li>
<li>19 </li>
<li>20 </li>
<li>21 </li>
<li>22 </li>
<li>23 </li>
<li>24 </li>
<li>25 </li>
<li>26 </li>
<li>27 </li>
<li>28 </li>
<li>29 </li>
<li>30 </li>
<li>31 </li>
<li>32 </li>
<li>33 </li>
<li>34 </li>
<li>35 </li>
<li>36 </li>
<li>37 </li>
<li>38 </li>
<li>39 </li>
<li>40 </li>
<li>41 </li>
<li>42 </li>
<li>43 </li>
<li>44 </li>
<li>45 </li>
<li>46 </li>
<li>47 </li>
<li>48 </li>
<li>49 </li>
<li>50 </li>
<li>51 </li>
<li>52 </li>
<li>53 </li>
<li>54 </li>
<li>55 </li>
<li>56 </li>
<li>57 </li>
<li>58 </li>
<li>59 </li>
<li>60 </li>
<li>61 </li>
<li>62 </li>
<li>63 </li>
<li>64 </li>
<li>65 </li>
<li>66 </li>
<li>67 </li>
<li>68 </li>
<li>69 </li>
<li>70 </li>
<li>71 </li>
<li>72 </li>
<li>73 </li>
<li>74 </li>
<li>75 </li>
<li>76 </li>
<li>77 </li>
<li>78 </li>
<li>79 </li>
<li>80 </li>
<li>81 </li>
<li>82 </li>
<li>83 </li>
<li>84 </li>
<li>85 </li>
<li>86 </li>
<li>87 </li>
<li>88 </li>
<li>89 </li>
<li>90 </li>
<li>91 </li>
<li>92 </li>
<li>93 </li>
<li>94 </li>
<li>95 </li>
<li>96 </li>
<li>97 </li>
<li>98 </li>
<li>99 </li>
<li>100 </li>
<li>101 </li>
<li>102 </li>
<li>103 </li>
<li>104 </li>
<li>105 </li>
<li>106 </li>
<li>107 </li>
<li>108 </li>
<li>109 </li>
<li>110 </li>
<li>111 </li>
<li>112 </li>
<li>113 </li>
<li>114 </li>
<li>115 </li>
<li>116 </li>
<li>117 </li>
<li>118 </li>
<li>119 </li>
<li>120 </li>
<li>121 </li>
<li>122 </li>
<li>123 </li>
<li>124 </li>
<li>125 </li>
<li>126 </li>
<li>127 </li>
<li>128 </li>
<li>129 </li>
<li>130 </li>
<li>131 </li>
<li>132 </li>
<li>133 </li>
<li>134 </li>
<li>135 </li>
<li>136 </li>
<li>137 </li>
<li>138 </li>
<li>139 </li>
<li>140 </li>
<li>141 </li>
<li>142 </li>
<li>143 </li>
<li>144 </li>
<li>145 </li>
<li>146 </li>
<li>147 </li>
<li>148 </li>
<li>149 </li>
<li>150 </li>
<li>151 </li>
<li>152 </li>
<li>153 </li>
<li>154 </li>
<li>155 </li>
<li>156 </li>
<li>157 </li>
<li>158 </li>
<li>159 </li>
<li>160 </li>
<li>161 </li>
<li>162 </li>
<li>163 </li>
<li>164 </li>
<li>165 </li>
<li>166 </li>
<li>167 </li>
<li>168 </li>
<li>169 </li>
<li>170 </li>
<li>171 </li>
<li>172 </li>
<li>173 </li>
<li>174 </li>
<li>175 </li>
<li>176 </li>
<li>177 </li>
<li>178 </li>
<li>179 </li>
<li>180 </li>
<li>181 </li>
<li>182 </li>
<li>183 </li>
<li>184 </li>
<li>185 </li>
<li>186 </li>
<li>187 </li>
<li>188 </li>
</ul>
<p>创建权限认证的 MyShiroCasRealm.java</p>
<pre><code>package org.springboot.sample.security;

import java.util.List;

import javax.annotation.PostConstruct;

import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.cas.CasRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springboot.sample.config.ShiroCasConfiguration;
import org.springboot.sample.dao.IUserDao;
import org.springboot.sample.entity.Role;
import org.springboot.sample.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

public class MyShiroCasRealm extends CasRealm{

    private static final Logger logger = LoggerFactory.getLogger(MyShiroCasRealm.class);

    @Autowired
    private IUserDao userDao; 

    @PostConstruct
    public void initProperty(){
//      setDefaultRoles(&quot;ROLE_USER&quot;);
        setCasServerUrlPrefix(ShiroCasConfiguration.casServerUrlPrefix);
        // 客户端回调地址
        setCasService(ShiroCasConfiguration.shiroServerUrlPrefix + ShiroCasConfiguration.casFilterUrlPattern);
    }

    /**
     * 权限认证，为当前登录的Subject授予角色和权限 
     * @see 经测试：本例中该方法的调用时机为需授权资源被访问时 
     * @see 经测试：并且每次访问需授权资源时都会执行该方法中的逻辑，这表明本例中默认并未启用AuthorizationCache 
     * @see 经测试：如果连续访问同一个URL（比如刷新），该方法不会被重复调用，Shiro有一个时间间隔（也就是cache时间，在ehcache-shiro.xml中配置），超过这个时间间隔再刷新页面，该方法会被执行
     */
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
        logger.info(&quot;##################执行Shiro权限认证##################&quot;);
        //获取当前登录输入的用户名，等价于(String) principalCollection.fromRealm(getName()).iterator().next();
        String loginName = (String)super.getAvailablePrincipal(principalCollection); 
        //到数据库查是否有此对象
        User user=userDao.findByName(loginName);// 实际项目中，这里可以根据实际情况做缓存，如果不做，Shiro自己也是有时间间隔机制，2分钟内不会重复执行该方法
        if(user!=null){
            //权限信息对象info,用来存放查出的用户的所有的角色（role）及权限（permission）
            SimpleAuthorizationInfo info=new SimpleAuthorizationInfo();
            //用户的角色集合
            info.setRoles(user.getRolesName());
            //用户的角色对应的所有权限，如果只使用角色定义访问权限，下面的四行可以不要
            List&lt;Role&gt; roleList=user.getRoleList();
            for (Role role : roleList) {
                info.addStringPermissions(role.getPermissionsName());
            }
            // 或者按下面这样添加
            //添加一个角色,不是配置意义上的添加,而是证明该用户拥有admin角色    
//            simpleAuthorInfo.addRole(&quot;admin&quot;);  
            //添加权限  
//            simpleAuthorInfo.addStringPermission(&quot;admin:manage&quot;);  
//            logger.info(&quot;已为用户[mike]赋予了[admin]角色和[admin:manage]权限&quot;);
            return info;
        }
        // 返回null的话，就会导致任何用户访问被拦截的请求时，都会自动跳转到unauthorizedUrl指定的地址
        return null;
    }

}
</code></pre><ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
<li>9 </li>
<li>10 </li>
<li>11 </li>
<li>12 </li>
<li>13 </li>
<li>14 </li>
<li>15 </li>
<li>16 </li>
<li>17 </li>
<li>18 </li>
<li>19 </li>
<li>20 </li>
<li>21 </li>
<li>22 </li>
<li>23 </li>
<li>24 </li>
<li>25 </li>
<li>26 </li>
<li>27 </li>
<li>28 </li>
<li>29 </li>
<li>30 </li>
<li>31 </li>
<li>32 </li>
<li>33 </li>
<li>34 </li>
<li>35 </li>
<li>36 </li>
<li>37 </li>
<li>38 </li>
<li>39 </li>
<li>40 </li>
<li>41 </li>
<li>42 </li>
<li>43 </li>
<li>44 </li>
<li>45 </li>
<li>46 </li>
<li>47 </li>
<li>48 </li>
<li>49 </li>
<li>50 </li>
<li>51 </li>
<li>52 </li>
<li>53 </li>
<li>54 </li>
<li>55 </li>
<li>56 </li>
<li>57 </li>
<li>58 </li>
<li>59 </li>
<li>60 </li>
<li>61 </li>
<li>62 </li>
<li>63 </li>
<li>64 </li>
<li>65 </li>
<li>66 </li>
<li>67 </li>
<li>68 </li>
<li>69 </li>
<li>70 </li>
<li>71 </li>
<li>72 </li>
</ul>
<p><img src="http://static.blog.csdn.net/images/save_snippets.png" alt=""></p>
<ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
<li>9 </li>
<li>10 </li>
<li>11 </li>
<li>12 </li>
<li>13 </li>
<li>14 </li>
<li>15 </li>
<li>16 </li>
<li>17 </li>
<li>18 </li>
<li>19 </li>
<li>20 </li>
<li>21 </li>
<li>22 </li>
<li>23 </li>
<li>24 </li>
<li>25 </li>
<li>26 </li>
<li>27 </li>
<li>28 </li>
<li>29 </li>
<li>30 </li>
<li>31 </li>
<li>32 </li>
<li>33 </li>
<li>34 </li>
<li>35 </li>
<li>36 </li>
<li>37 </li>
<li>38 </li>
<li>39 </li>
<li>40 </li>
<li>41 </li>
<li>42 </li>
<li>43 </li>
<li>44 </li>
<li>45 </li>
<li>46 </li>
<li>47 </li>
<li>48 </li>
<li>49 </li>
<li>50 </li>
<li>51 </li>
<li>52 </li>
<li>53 </li>
<li>54 </li>
<li>55 </li>
<li>56 </li>
<li>57 </li>
<li>58 </li>
<li>59 </li>
<li>60 </li>
<li>61 </li>
<li>62 </li>
<li>63 </li>
<li>64 </li>
<li>65 </li>
<li>66 </li>
<li>67 </li>
<li>68 </li>
<li>69 </li>
<li>70 </li>
<li>71 </li>
<li>72 </li>
</ul>
<p>在Controller中添加一个方法，用于将登录URL简单化，提供一个重定向功能</p>
<pre><code>    @RequestMapping(value=&quot;/login&quot;,method=RequestMethod.GET)
    public String loginForm(Model model){
        model.addAttribute(&quot;user&quot;, new User());
//      return &quot;login&quot;;
        return &quot;redirect:&quot; + ShiroCasConfiguration.loginUrl;
    }
</code></pre><ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
</ul>
<p><img src="http://static.blog.csdn.net/images/save_snippets.png" alt=""></p>
<ul>
<li>1 </li>
<li>2 </li>
<li>3 </li>
<li>4 </li>
<li>5 </li>
<li>6 </li>
<li>7 </li>
<li>8 </li>
</ul>
<p>本文主要是介绍如何在Spring Boot中集成Shiro+Cas，并非一个从零创建工程到整体完成的介绍。<br>上面贴出了2个主要的Java类，整个工程的其他所有代码没有任何与Shiro和Cas耦合的地方。如果需要jsp页面、Controller、实体类、连接 <a href="http://lib.csdn.net/base/14" target="_blank" rel="noopener"><br>数据库 </a> 测试数据等代码，可以先参考文章： <a href="http://blog.csdn.net/lsy0903/article/details/52910744" target="_blank" rel="noopener"><br>http://blog.csdn.net/lsy0903/article/details/52910744
</a> （建议先看这篇文章再看本文）</p>

        
        </div>
        <footer class="article-footer">
            <div class="share-container">


    <div class="bdsharebuttonbox">
    <a href="#" class="bds_more" data-cmd="more">分享到：</a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间">QQ空间</a>
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博">新浪微博</a>
    <a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博">腾讯微博</a>
    <a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网">人人网</a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信">微信</a>
</div>
<script>
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{"bdSize":16}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
<style>
    .bdshare_popup_box {
        border-radius: 4px;
        border: #e1e1e1 solid 1px;
    }
    .bdshare-button-style0-16 a,
    .bdshare-button-style0-16 .bds_more {
        padding-left: 20px;
        margin: 6px 10px 6px 0;
    }
    .bdshare_dialog_list a,
    .bdshare_popup_list a,
    .bdshare_popup_bottom a {
        font-family: 'Microsoft Yahei';
    }
    .bdshare_popup_top {
        display: none;
    }
    .bdshare_popup_bottom {
        height: auto;
        padding: 5px;
    }
</style>


</div>

            
    
        <a href="https://www.itchina.top/2018/04/20/Spring Boot 集成Shiro和CAS/#comments" id="sourceId::2018/04/20/Spring Boot 集成Shiro和CAS/" class="article-comment-link cy_cmt_count">评论</a>
    

        </footer>
    </div>
    
        
<nav id="article-nav">
    
        <a href="/2018/04/20/Spring Boot 环境变量读取 和 属性对象的绑定/" id="article-nav-newer" class="article-nav-link-wrap">
            <strong class="article-nav-caption">上一篇</strong>
            <div class="article-nav-title">
                
                    Spring Boot 环境变量读取 和 属性对象的绑定
                
            </div>
        </a>
    
    
        <a href="/2018/04/20/Spring Boot 过滤器、监听器/" id="article-nav-older" class="article-nav-link-wrap">
            <strong class="article-nav-caption">下一篇</strong>
            <div class="article-nav-title">Spring Boot 过滤器、监听器</div>
        </a>
    
</nav>


    
</article>


    
    
        <section id="comments">
    <div id="SOHUCS" sid="2018/04/20/Spring Boot 集成Shiro和CAS/"></div>
</section>
    

</section>
            
                
<aside id="sidebar">
   
        
    <div class="widget-wrap">
        <h3 class="widget-title">最新文章</h3>
        <div class="widget">
            <ul id="recent-post" class="no-thumbnail">
                
                    <li>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/categories/IDE/">IDE</a></p>
                            <p class="item-title"><a href="/2018/04/20/项目相关的CVS操作/" class="title">项目相关的CVS操作</a></p>
                            <p class="item-date"><time datetime="2018-04-19T16:34:21.467Z" itemprop="datePublished">2018-04-20</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/categories/J2EE/">J2EE</a></p>
                            <p class="item-title"><a href="/2018/04/20/图片转换PDF文件/" class="title">图片转换PDF文件</a></p>
                            <p class="item-date"><time datetime="2018-04-19T16:34:21.449Z" itemprop="datePublished">2018-04-20</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-inner">
                            <p class="item-category"><a class="article-category-link" href="/categories/Spring/">Spring</a></p>
                            <p class="item-title"><a href="/2018/04/20/使用 Spring Data JPA 简化 JPA 开发/" class="title">使用 Spring Data JPA 简化 JPA 开发</a></p>
                            <p class="item-date"><time datetime="2018-04-19T16:34:21.448Z" itemprop="datePublished">2018-04-20</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-inner">
                            <p class="item-category"></p>
                            <p class="item-title"><a href="/2018/04/20/通过Ajax进行POST提交JSON类型的数据到SpringMVC Controller的方法/" class="title">通过Ajax进行POST提交JSON类型的数据到SpringMVC Controller的方法</a></p>
                            <p class="item-date"><time datetime="2018-04-19T16:34:21.448Z" itemprop="datePublished">2018-04-20</time></p>
                        </div>
                    </li>
                
                    <li>
                        
                        <div class="item-inner">
                            <p class="item-category"></p>
                            <p class="item-title"><a href="/2018/04/20/面试感悟----一名3年工作经验的程序员应该具备的技能/" class="title">面试感悟----一名3年工作经验的程序员应该具备的技能</a></p>
                            <p class="item-date"><time datetime="2018-04-19T16:34:21.447Z" itemprop="datePublished">2018-04-20</time></p>
                        </div>
                    </li>
                
            </ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">分类</h3>
        <div class="widget">
            <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/ActiveMQ/">ActiveMQ</a><span class="category-list-count">7</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/ExtJs/">ExtJs</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Git/">Git</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/IDE/">IDE</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/J2EE/">J2EE</a><span class="category-list-count">7</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/J2EE/Spring/">Spring</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Redis/">Redis</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Spring/">Spring</a><span class="category-list-count">21</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/cnn图片数据处理、显示/">cnn图片数据处理、显示</a><span class="category-list-count">1</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/cnn图片数据处理、显示/python数据分析/">python数据分析</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/web前端/">web前端</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/数据库/">数据库</a><span class="category-list-count">3</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/categories/数据库/集群/">集群</a><span class="category-list-count">1</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/categories/集群/">集群</a><span class="category-list-count">2</span></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">归档</h3>
        <div class="widget">
            <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">四月 2018</a><span class="archive-list-count">65</span></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">标签</h3>
        <div class="widget">
            <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Apache/">Apache</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Docker/">Docker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Druid/">Druid</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ImageToPDF/">ImageToPDF</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Logstash/">Logstash</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Spring-Boot/">Spring Boot</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/activemq/">activemq</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ajax/">ajax</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/angular/">angular</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cas/">cas</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/">docker</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exception/">exception</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ext/">ext</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/extjs/">extjs</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/find/">find</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/github/">github</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ide/">ide</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/idea/">idea</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jboss/">jboss</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jmx/">jmx</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jpa/">jpa</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lombok/">lombok</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mvc/">mvc</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mybatis/">mybatis</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mysql/">mysql</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/">nginx</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/numpy/">numpy</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/seo/">seo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/server/">server</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shiro/">shiro</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spring/">spring</a><span class="tag-list-count">17</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spring-mvc/">spring mvc</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spring-boo/">spring-boo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sql-server/">sql server</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zookeeper/">zookeeper</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/优化/">优化</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/分布式日志/">分布式日志</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/多线程/">多线程</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/工作/">工作</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/异常/">异常</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/异常处理/">异常处理</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/搜索引擎/">搜索引擎</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/数据分析/">数据分析</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/汉字转拼音/">汉字转拼音</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/版本控制系统/">版本控制系统</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/程序员/">程序员</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/经验/">经验</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/集群/">集群</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/面试/">面试</a><span class="tag-list-count">1</span></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">标签云</h3>
        <div class="widget tagcloud">
            <a href="/tags/Apache/" style="font-size: 10px;">Apache</a> <a href="/tags/Docker/" style="font-size: 10px;">Docker</a> <a href="/tags/Druid/" style="font-size: 10px;">Druid</a> <a href="/tags/ImageToPDF/" style="font-size: 10px;">ImageToPDF</a> <a href="/tags/Logstash/" style="font-size: 10px;">Logstash</a> <a href="/tags/Spring-Boot/" style="font-size: 10px;">Spring Boot</a> <a href="/tags/activemq/" style="font-size: 18px;">activemq</a> <a href="/tags/ajax/" style="font-size: 10px;">ajax</a> <a href="/tags/angular/" style="font-size: 10px;">angular</a> <a href="/tags/cas/" style="font-size: 10px;">cas</a> <a href="/tags/docker/" style="font-size: 10px;">docker</a> <a href="/tags/exception/" style="font-size: 10px;">exception</a> <a href="/tags/ext/" style="font-size: 14px;">ext</a> <a href="/tags/extjs/" style="font-size: 14px;">extjs</a> <a href="/tags/find/" style="font-size: 10px;">find</a> <a href="/tags/git/" style="font-size: 10px;">git</a> <a href="/tags/github/" style="font-size: 10px;">github</a> <a href="/tags/ide/" style="font-size: 12px;">ide</a> <a href="/tags/idea/" style="font-size: 10px;">idea</a> <a href="/tags/java/" style="font-size: 16px;">java</a> <a href="/tags/javascript/" style="font-size: 12px;">javascript</a> <a href="/tags/jboss/" style="font-size: 10px;">jboss</a> <a href="/tags/jmx/" style="font-size: 10px;">jmx</a> <a href="/tags/jpa/" style="font-size: 10px;">jpa</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lombok/" style="font-size: 10px;">lombok</a> <a href="/tags/mvc/" style="font-size: 10px;">mvc</a> <a href="/tags/mybatis/" style="font-size: 10px;">mybatis</a> <a href="/tags/mysql/" style="font-size: 12px;">mysql</a> <a href="/tags/nginx/" style="font-size: 10px;">nginx</a> <a href="/tags/numpy/" style="font-size: 10px;">numpy</a> <a href="/tags/seo/" style="font-size: 10px;">seo</a> <a href="/tags/server/" style="font-size: 10px;">server</a> <a href="/tags/shiro/" style="font-size: 12px;">shiro</a> <a href="/tags/spring/" style="font-size: 20px;">spring</a> <a href="/tags/spring-mvc/" style="font-size: 10px;">spring mvc</a> <a href="/tags/spring-boo/" style="font-size: 10px;">spring-boo</a> <a href="/tags/sql-server/" style="font-size: 10px;">sql server</a> <a href="/tags/windows/" style="font-size: 10px;">windows</a> <a href="/tags/zookeeper/" style="font-size: 10px;">zookeeper</a> <a href="/tags/优化/" style="font-size: 12px;">优化</a> <a href="/tags/分布式日志/" style="font-size: 10px;">分布式日志</a> <a href="/tags/多线程/" style="font-size: 10px;">多线程</a> <a href="/tags/工作/" style="font-size: 10px;">工作</a> <a href="/tags/异常/" style="font-size: 10px;">异常</a> <a href="/tags/异常处理/" style="font-size: 10px;">异常处理</a> <a href="/tags/搜索引擎/" style="font-size: 12px;">搜索引擎</a> <a href="/tags/数据分析/" style="font-size: 10px;">数据分析</a> <a href="/tags/汉字转拼音/" style="font-size: 10px;">汉字转拼音</a> <a href="/tags/版本控制系统/" style="font-size: 10px;">版本控制系统</a> <a href="/tags/程序员/" style="font-size: 10px;">程序员</a> <a href="/tags/经验/" style="font-size: 10px;">经验</a> <a href="/tags/集群/" style="font-size: 10px;">集群</a> <a href="/tags/面试/" style="font-size: 10px;">面试</a>
        </div>
    </div>

    
        
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">链接</h3>
        <div class="widget">
            <ul>
                
                    <li>
                        <a href="http://www.baidu.com">百度</a>
                    </li>
                
            </ul>
        </div>
    </div>


    
    <div id="toTop" class="fa fa-angle-up"></div>
</aside>

            
        </div>
        <!--google 底部广告 -->
<div style="width:100%;text-align: center;clear: both;margin-bottom: 20px;" class="hidden-xs">
    <script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <!-- 博客footer上方的广告 -->
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-8254913025324557"
         data-ad-slot="3369473724"
         data-ad-format="auto"></ins>
    <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
</div>
<footer id="footer">
    <div class="outer">
        <div id="footer-info" class="inner">
            &copy;2018 - 2018&nbsp; LErry Li &nbsp;版权所有<br>
			<a href="http://www.miitbeian.gov.cn">沪ICP备17054498号-3</a>
        </div>
    </div>
</footer>
        
    
    <script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cytxPSIHr"></script>
    <script charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/changyan.js" ></script>
    <script type="text/javascript">
    window.changyan.api.config({
    appid: 'cytxPSIHr',
    conf: 'prod_3c92d05d8ba4377e48c5fe27c2159761'
    });
    </script>




    
        <script src="/libs/lightgallery/js/lightgallery.min.js"></script>
        <script src="/libs/lightgallery/js/lg-thumbnail.min.js"></script>
        <script src="/libs/lightgallery/js/lg-pager.min.js"></script>
        <script src="/libs/lightgallery/js/lg-autoplay.min.js"></script>
        <script src="/libs/lightgallery/js/lg-fullscreen.min.js"></script>
        <script src="/libs/lightgallery/js/lg-zoom.min.js"></script>
        <script src="/libs/lightgallery/js/lg-hash.min.js"></script>
        <script src="/libs/lightgallery/js/lg-share.min.js"></script>
        <script src="/libs/lightgallery/js/lg-video.min.js"></script>
    
    
        <script src="/libs/justified-gallery/jquery.justifiedGallery.min.js"></script>
    
    



<!-- Custom Scripts -->
<script src="/js/main.js"></script>

    </div>
</body>
</html>